<template>
  <div class="q-table-body">
    <table :class="[{
      'striped': stripe,
      }]">
      <tbody>
        <tr v-for="(row, index) in data" :key="row.rowkey || index">
          <td  v-for="(col, idx) in columns" :key="idx" :style="{
              width: col.width
            }"
            :class="[{ 'current-row': stripe&&index/2==0 }]"
          >
          {{stripe}}
            <slot name="td" :row="row" :column="col">
              {{col.parse ? col.parse(col, row) : (col.name ? row[col.name] : row[idx])}}
            </slot>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Array,
      default() {
        return [];
      }
    },
    columns: {
      type: Array,
      default() {
        return [];
      }
    },
     stripe: {
      type: Boolean,
      default() {
        return false;
      }
    }
  },
  methods:{
  getRowClass(row, rowIndex) {
      const classes = ['el-table__row'];
      if (this.table.highlightCurrentRow && row === this.store.states.currentRow) {
        classes.push('current-row');
      }
    }
  }
}
</script>
